package com.hooper.hosp.controller;

import com.hooper.hosp.service.DepartmentService;
import com.hooper.hosp.vo.DepartmentVo;
import com.hooper.hospital.common.result.Result;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Tim Hooper
 * @version 1.0
 * @time 2022/10/01/15:50
 */
@Api("department controller")
@RestController
@Slf4j
//@CrossOrigin
@RequiredArgsConstructor
@RequestMapping("/admin/hosp/department")
public class DepartmentController {
    public final DepartmentService departmentService;

    @GetMapping("/list/{hoscode}")
    public Result<List<DepartmentVo>> getDepartList(@PathVariable String hoscode) {
        List<DepartmentVo> list = departmentService.getDepartmentListByHoscode(hoscode);
        return Result.ok(list);
    }
}
